import java.io.*;
import java.net.Socket;
import java.net.UnknownHostException;

// Ejercicio de prueba del SVN
//jkhjhkhg4444444444444444444444
//54534235321321
public class Cliente {



	public static void main(String[] args) throws IOException{

		Socket elClientEcho = null;
		PrintWriter out = null;
		BufferedReader in = null;
		String probando;

		try{
			elClientEcho = new Socket("localHost",35);
			out = new PrintWriter(elClientEcho.getOutputStream(),true);
			in = new BufferedReader (new InputStreamReader(elClientEcho.getInputStream()));
			probando= "hola";
		}catch(UnknownHostException e) {
			System.err.println("No se conoce el localHost");
			System.exit(1);

		} catch (IOException e) {
			System.err.println("Couldn't get I/O for "
					+ "the connection to: localhost.");
			System.exit(1);
		}

		BufferedReader stdIn = new BufferedReader(
				new InputStreamReader(System.in));
		String userInput;			// Creo String para entrada
		System.out.println("Empiece a escrbir");
		while ((userInput = stdIn.readLine()) != null) {
			out.println(userInput);
			System.out.println("echo: " + in.readLine());
			if(userInput.equals("chau")) {
				break;
			}
		}

		out.close();
		in.close();
		stdIn.close();
		elClientEcho.close();
	}
}